package com.yjc.rabbitMQ.two;

import com.rabbitmq.client.Channel;
import com.yjc.rabbitMQ.utils.RabbitMQUtils;

import java.util.Queue;
import java.util.Scanner;

/**
 * @author shkstart
 * @create 2022-07-30 15:41
 */
public class Task01 {

    private static final String QUEUE_NAME = "Hello_queue_product *(￣▽￣)";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMQUtils.getChannel();
        channel.queueDeclare(QUEUE_NAME, false, false, false, null);
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            System.out.print("请输入内容：");
            channel.basicPublish("", QUEUE_NAME, null, sc.next().getBytes());
        }
        System.out.println("消息发送完毕");
    }
}
